package com.film.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.JdbcTemplate;

import com.film.dao.AdminDao;
import com.film.domain.Admin;
import com.film.rowMapper.AdminRowMapper;
import com.film.util.DBUtil;

public class AdminDaoImpl implements AdminDao {
	private JdbcTemplate temp = new JdbcTemplate(DBUtil.getDataScorse());
	@Override
	public Admin login(String username, String password) {
		Admin admin=null;
		String sql="SELECT * FROM admin WHERE admin_name=? and admin_password=?";
		List<Admin> admins = temp.query(sql,new AdminRowMapper(),username,password);
		if(admins.size() == 1) {
			admin = admins.get(0);
		} 
		return admin;
	}

}
